#define GET_NUMBER_OF_SLICES	\
    li      t0, 0x8;\
    lb	    a0, 0x1f2(t8);\
    bne	    a0, 0x3, 1f;\
    nop;\
    li      t0, 0x2;\
    b       933f;\
    nop;\
1:;\
    bne     a0, 0x5, 934f;\
    nop;\
    li      t0, 0x4;\
    b       933f;\
    nop;\
934:;\
    dli     t1, 0x250;\
    or      t1, t1, t8;\
    lb      a0, 0x2(t1);\
    dli     t1, 0x1;\
    and     a0, a0, t1;\
    bne     a0, t1, 933f ;\
    nop;\
    daddu   t0, t0, 0x1;\
933:;

#define PRINT_THE_MC_PARAM \
    dli     ta0, DDR_PARAM_NUM;\
    GET_NODE_ID_a0;\
    dli     ta1, 0x900000000ff00000;\
    or      ta1, ta1, a0;\
1:;\
    ld      ta2, 0x0(ta1);\
    move    a0, ta1;\
    and     a0, a0, 0xfff;\
    bal     hexserial;\
    nop;\
    PRINTSTR(":  ");\
    dsrl    a0, ta2, 32;\
    bal     hexserial;\
    nop;\
    move    a0, ta2;\
    bal     hexserial;\
    nop;\
    PRINTSTR("\r\n");\
    daddiu  ta0, ta0, -1;\
    daddiu  ta1, ta1, 8;\
    bnez    ta0, 1b;\
    nop;

#define WRDQS_ADJUST_LOOP \
933:;\
    subu    t0, t0, 0x1;\
    beq     t0, 0x0, 936f;\
    nop;\
    daddu   t1, t1, 0x20;\
    lb      a0, OFFSET_DLL_WRDQS(t1);\
    bgeu    a0, a2, 933b;\
    nop;\
    bleu    a0, a3, 933b;\
    nop;\
    dli     ta0, 0x8;\
    and     ta0, ta0, a0;\
    beqz    ta0, 934f;\
    nop;\
    sb      a3, OFFSET_DLL_WRDQS(t1);\
    b       935f;\
    nop;\
934:;\
    sb      a2, OFFSET_DLL_WRDQS(t1);\
935:;\
	lb		a0, OFFSET_DLL_WRDQS(t1);\
	blt		a0, WRDQS_LTHF_STD, 937f;\
	nop;\
	li		ta0, 0x0;\
	sb		ta0, OFFSET_WRDQS_LTHF(t1);\
	b		938f;\
	nop;\
937:;\
	li		ta0, 0x1;\
	sb		ta0, OFFSET_WRDQS_LTHF(t1);\
938:;\
	dsubu	a0, a0, 0x20;\
	dli		ta0, 0x7f;\
	and		a0, a0, ta0;\
	sb		a0, OFFSET_DLL_WRDQ(t1);\
	blt		a0, WRDQ_LTHF_STD, 937f;\
	nop;\
	li		ta0, 0x0;\
	sb		ta0, OFFSET_WRDQ_LTHF(t1);\
	b		938f;\
	nop;\
937:;\
	li		ta0, 0x1;\
	sb		ta0, OFFSET_WRDQ_LTHF(t1);\
938:;\
    b       933b;\
    nop;\
936:;\

#define RDOE_SUB_TRDDATA_ADD	\
	bne		a0, 0x4, 934f;\
	nop;\
    li      a1, 0x8;\
    dli     ta0, 0x250;\
    or      ta0, ta0, t8;\
    lb      a0, 0x2(ta0);\
    dli     ta0, 0x1;\
    and     a0, a0, ta0;\
    bne     a0, ta0, 932f ;\
    nop;\
    daddu   a1, a1, 0x1;\
932: ;\
	dli		ta0, 0x28;\
	or		ta0, ta0, t8;\
933: ;\
	lb		a0, 0x7(ta0);\
	dsubu	a0, a0, 0x1;\
	sb		a0, 0x7(ta0);\
	lb		a0, 0x6(ta0);\
	dsubu	a0, a0, 0x1;\
	sb		a0, 0x6(ta0);\
	daddu	ta0, ta0, 0x20;\
	dsubu	a1, a1, 0x1;\
	bnez	a1, 933b;\
	nop;\
	dli		ta0, 0x1c0;\
	or		ta0, ta0, t8;\
	lb		a0, 0x0(ta0);\
	daddu	a0, a0, 0x1;\
	sb		a0, 0x0(ta0);\
934: ;
#define	RDOE_ADD_TRDDATA_SUB		\
	bne		a0, 0x0, 934f;\
	nop ;\
    li      a1, 0x8;\
    dli     ta0, 0x250;\
    or      ta0, ta0, t8;\
    lb      a0, 0x2(ta0);\
    dli     ta0, 0x1;\
    and     a0, a0, ta0;\
    bne     a0, ta0, 932f ;\
    nop;\
    daddu   a1, a1, 0x1;\
932: ;\
	dli		ta0, 0x28;\
	or		ta0, ta0, t8;\
933: ;\
	lb		a0, 0x7(ta0);\
	daddu	a0, a0, 0x1;\
	sb		a0, 0x7(ta0);\
	lb		a0, 0x6(ta0);\
	daddu	a0, a0, 0x1;\
	sb		a0, 0x6(ta0);\
	daddu	ta0, ta0, 0x20;\
	dsubu	a1, a1, 0x1;\
	bnez	a1, 933b;\
	nop;\
	dli		ta0, 0x1c0;\
	or		ta0, ta0, t8;\
	lb		a0, 0x0(ta0);\
	dsubu	a0, a0, 0x1;\
	sb		a0, 0x0(ta0);\
934: ;

